GBML manual / Core

profile_cycles

The same as profile_percent, but counted in CPU cycles, the GBA's own tiny clock ticks, instead of a percentage.

Works differently on Game Boy - The Game Boy has no frame profiler: profile_enabled says false and every profile number reads 0.

Works differently on Game Boy Color - The Game Boy Color has no frame profiler: profile_enabled says false and every profile number reads 0.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

profile_cycles(phase) -> int

Arguments

NameType
phaseint

Returns

int

Description

The same measurement as profile_percent, but counted in CPU cycles instead of a percentage. A cycle is one tick of the GBA's processor clock, which runs about 16.8 million times a second. One whole frame is profile_budget() cycles.

Use it when you want the real count, for example to compare two ways of doing the same job.

Example

var cycles = profile_cycles(PROFILE_TOTAL);
draw_text(4, 4, $"CYCLES {cycles}");

Draws how many cycles the last frame took.

Cost

The timer counts in steps of 64 cycles, so this is always a multiple of 64. That is about a fiftieth of a percent of a frame, much finer than anything worth drawing.

On the GBA

The timer counts in steps of 64 cycles, so this is always a multiple of 64. One whole frame is profile_budget() cycles.

See also: profile_budgetprofile_percent